<template>
  <div class="card">
    <button type="button" @click="add">count is {{ count11 }}</button>
  </div>
</template>

<script>
import { mapState, mapStores } from 'pinia'
import { useSystemStore } from '@/store/system'
export default {
  data() {
    return {}
  },
  computed: {
    ...mapStores(useSystemStore),
    // 允许访问组件内部的 this.count
    // 与从 store.count 读取相同
    ...mapState(useSystemStore, {
      // myOwnName: 'count',
      // 您还可以编写一个访问 store 的函数
      count11: store => store.count
    })
  },
  methods: {
    add() {
      this.systemStore.count++
      console.log(1111, this, this.systemStore.count)
    }
  }
}
</script>

<style scoped>
.read-the-docs {
  color: #888;
}
</style>
